
#include <bur/plctypes.h>

#ifdef _DEFAULT_INCLUDES
#include <AsDefault.h>
#endif


void _CYCLIC ProgramCyclic(void)
{
	SimOutputs.Q1_ACT_POS = gVisData.gRoboPosition[0];
	SimOutputs.Q2_ACT_POS = gVisData.gRoboPosition[1];
	SimOutputs.Q3_ACT_POS = gVisData.gRoboPosition[2];
	SimOutputs.Q4_ACT_POS = gVisData.gRoboPosition[3];
	SimOutputs.Q5_ACT_POS = gVisData.gRoboPosition[4];
	SimOutputs.Q6_ACT_POS = gVisData.gRoboPosition[5];


	McAcpTrakShuttleMonData *Shuttle1Mon = &AsmShuttleMon.Shuttle[0];
	McAcpTrakShuttleMonData *Shuttle2Mon = &AsmShuttleMon.Shuttle[1];
	McAcpTrakShuttleMonData *Shuttle3Mon = &AsmShuttleMon.Shuttle[2];
	
		
			
	if (Shuttle1Mon->Available)                                                           
	{			
		SimOutputs.Shuttle_VIS_X = AsmShuttleMon.Shuttle[0].Position.X;
		SimOutputs.Shuttle_VIS_Y	= AsmShuttleMon.Shuttle[0].Position.Y;
		SimOutputs.Shuttle_VIS_C=AsmShuttleMon.Shuttle[0].Orientation.Angle1;
		SimOutputs.Shuttle_VIS_F = ShuttleColor_1; //3
		UserDataStruct* pData1 = (UserDataStruct*) Shuttle3Mon->UserData;
		if(pData1 != 0)
		{
			SimOutputs.Shuttle_VIS_F = (INT) pData1->Color;
			SimOutputs.Shuttle_VIS_F = Color_Shuttle1; //ShuttleColor_1; // 3 Zweiter Shuttle
		}
		
		SimOutputs.Shuttle2_VIS_X= AsmShuttleMon.Shuttle[1].Position.X;
		SimOutputs.Shuttle2_VIS_Y=AsmShuttleMon.Shuttle[1].Position.Y;
		SimOutputs.Shuttle2_VIS_C=AsmShuttleMon.Shuttle[1].Orientation.Angle1;
		SimOutputs.Shuttle2_VIS_F = ShuttleColor_2; // 4
		UserDataStruct* pData2 = (UserDataStruct*) Shuttle2Mon->UserData; 
		if(pData2 != 0)
		{
			SimOutputs.Shuttle2_VIS_F = (INT) pData2->Color;
			SimOutputs.Shuttle2_VIS_F = Color_Shuttle2; //ShuttleColor_2; // 4 Erster Shuttle
		}
 
		SimOutputs.Shuttle3_VIS_X= AsmShuttleMon.Shuttle[2].Position.X;
		SimOutputs.Shuttle3_VIS_Y=AsmShuttleMon.Shuttle[2].Position.Y;
		SimOutputs.Shuttle3_VIS_C=AsmShuttleMon.Shuttle[2].Orientation.Angle1;
		SimOutputs.Shuttle3_VIS_F = ShuttleColor_3; //2
		UserDataStruct* pData3 = (UserDataStruct*) Shuttle3Mon->UserData;
		if(pData3 != 0)
		{
			SimOutputs.Shuttle3_VIS_F = (INT) pData3->Color;
			SimOutputs.Shuttle3_VIS_F = Color_Shuttle3;//ShuttleColor_3; //2 Dritter Shuttle von Links
		}
		SimOutputs.DISPLAY_DISTANCE = gShuttleMeter[0];	
		SimOutputs.DISPLAY_SPEED = gSystemInterface.Process.ProcessVel;
		
	}
	SimOutputs.DISPLAY_DINT_RES1 = ConnectionCounter;
}
